﻿<UserControl x:Class="EventLogAnalyzer.View.EventLogFilesListControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:Converter="clr-namespace:EventLogAnalyzer.View.Converter" mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <Converter:BoolToVisibilityConverter x:Key="boolToVisibilityConverter"/>
    </UserControl.Resources>
    <Grid>

        <ScrollViewer VerticalScrollBarVisibility="Visible" Margin="25,40,0,0" VerticalAlignment="Top" Name="scroll">
            <ItemsControl ItemsSource="{Binding Path=LogFileViewModels}">
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <StackPanel>
                            <Border Width="350" Height="40" Background="#FF654118" HorizontalAlignment="Left" CornerRadius="0,13,13,0" BorderThickness="2,3"  >
                                <Border.Effect>
                                    <DropShadowEffect Direction="230" />
                                </Border.Effect>
                                <Border.BorderBrush>
                                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                        <GradientStop Color="#FF4D300E" Offset="1"/>
                                        <GradientStop Color="#FFA77339"/>
                                    </LinearGradientBrush>
                                </Border.BorderBrush>
                                <Grid  VerticalAlignment="Center">
                                    <TextBlock Margin="20,5,15,0" Text="{Binding Path=FileName}" FontFamily="Century Gothic" FontSize="14" Foreground="#FFF8CD71" IsEnabled="False"/>
                                    <TextBlock Text="{Binding Path=NumberOfOccurrancesOfSelectedLog}" Margin="260,-5,15,0" Foreground="Wheat" FontFamily="Century Gothic" FontSize="12"  />
                                </Grid>
                            </Border>
                            <ItemsControl ItemsSource="{Binding Path=Logs}" Margin="10,10,0,0">
                                <ItemsControl.ItemTemplate>
                                    <DataTemplate>
                                        <TextBlock Margin="20,5,15,0" Text="{Binding Path=EventTitle}" Height="30" Width="400" FontFamily="Century Gothic" FontSize="14" Foreground="Black" Visibility="{Binding Path=IsToBeShown, Converter={StaticResource boolToVisibilityConverter}}" MouseDown="logEntry_MouseDown">
                                            <TextBlock.Style>
                                                    <Style TargetType="TextBlock">
                                                        <Style.Triggers>
                                                            <Trigger Property="IsMouseOver" Value="True">
                                                              <Setter Property="Background" Value="#FFF8CD71" />
                                                              <Setter Property="FontWeight" Value="Bold" />
                                                            </Trigger>                                                            
                                                            <DataTrigger Binding="{Binding Path=ShouldHighLight}" Value="True">
                                                                <Setter Property="BitmapEffect">
                                                                      <Setter.Value>
                                                                        <OuterGlowBitmapEffect GlowColor="Red" GlowSize="4"/>
                                                                      </Setter.Value>
                                                                </Setter>
                                                            </DataTrigger>                                                            
                                                          </Style.Triggers>
                                                    </Style>
                                            </TextBlock.Style>
                                        </TextBlock>
                                    </DataTemplate>
                                </ItemsControl.ItemTemplate>
                            </ItemsControl>
                        </StackPanel>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>
        </ScrollViewer>

        <Border Width="350" Height="40" Margin="5,5,0,0" Background="#FF654118" HorizontalAlignment="Left" BorderThickness="2,3" VerticalAlignment="Top" >
            <Border.Effect>
                <DropShadowEffect Direction="230" />
            </Border.Effect>
            <Border.BorderBrush>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FF4D300E" Offset="1"/>
                    <GradientStop Color="#FFA77339"/>
                </LinearGradientBrush>
            </Border.BorderBrush>
            <Grid x:Name="logGrid" VerticalAlignment="Center">
                <TextBox Margin="10,5,15,0" Text="Log files" FontFamily="Century Gothic" FontSize="16" Foreground="#FFF8CD71" FontWeight="Bold">
                    <TextBox.Template>
                        <ControlTemplate TargetType="TextBox">
                            <Border >
                                <ScrollViewer Margin="0" x:Name="PART_ContentHost" />
                            </Border>
                        </ControlTemplate>
                    </TextBox.Template>
                </TextBox>
            </Grid>
        </Border>
    </Grid>
</UserControl>
